package Lab5;

import java.awt.*;
import java.util.LinkedList;
import java.util.Random;

public class listIterator {
    public static void main(String[] args) {
        LinkedList<Integer> list = new LinkedList<Integer>();
        Random rand = new Random();
        rand.setSeed(1);
        for (int i = 0; i < 100000; i++) {
            list.add(rand.nextInt());
        }

        long start = System.currentTimeMillis();

        int b = 0;
        int c = 0;

        for (int i = 0; i < 100000; i++) {
            b++;
        }

        long t1 = System.currentTimeMillis() - start;
        start = System.currentTimeMillis();

        for (int a : list) {
            c++;
        }

        long t2 = System.currentTimeMillis() - start;

        System.out.println("t1: " + t1 + " t2: " + t2);
    }
}
